package com.zzc.legou.search.clients;

import com.baomidou.mybatisplus.extension.api.R;
import com.zzc.legou.item.entity.Brand;
import com.zzc.service.item.api.BrandApi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;



@FeignClient(name = "item-service",fallback = BrandClient.BrandClientFallBack.class)
public interface BrandClient extends BrandApi {

    @Component
    @RequestMapping("/brand-fallback")
    class BrandClientFallBack implements BrandClient{
        private static final Logger LOGGER = LoggerFactory.getLogger(BrandClientFallBack.class);
        /**
         * 出现异常信息返回
         * @param ids
         * @return
         */
        @Override
        public List<Brand> selectBrandByIds(List<Long> ids) {
            LOGGER.error("查询品牌失败");
            return null;
        }
    }
}
